var id= getId();
function closeSelf(){
  // window.parent.location.reload();
  // var index = parent.layer.getFrameIndex(window.name);
  // parent.layer.close(index);
  window.location.reload();
  // parent.reload();
}
layui.use('table', function(){ //渲染学生报修
  var table = layui.table;
  var util = layui.util;
  var indata = {};
  indata.managerId = 1;
  indata.type = 0;
  table.render({
    elem: '#repair_table'
    ,url:head+"/repair/noReadList?managerId="+id+"&type=0"
    ,toolbar: '#toolbarDemo'
    ,title: '用户数据表'
    ,request: {
      pageName: 'pageNum' //页码的参数名称，默认：page
      ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
    }
    ,cols: [[ 
      {field:'studentid', title:'学生学号', width:'15%'}
      ,{field:'studentAddr', title:'学生宿舍', width:'10%'}
      ,{field:'addtime', title:'申报时间', width:'15%', templet:function(d){return util.toDateString(d.ctime*1,"yyyy-MM-dd HH:mm")}}
      ,{field:'phone', title:'电话',width:'15%'}
      ,{field:'msg', title:'信息',width:'30%', maxlength:'20'}
      ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:'15%'}
    ]]
    ,page: true
  });
  
  
  //监听行工具事件
  table.on('tool(test)', function(obj){
    var data = obj.data;
    //console.log(obj)
    if(obj.event === 'refuse'){
      var id = data.id;
      layer.open({
        type: 2, 
        title:'详细信息',
        area: ['84%','86%'],
        offset:['5%','8%'],
        scrollbar: true,
        content: 'refuse_message.html?id='+id+'&type=0',//这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
        success: function(layero,index){
        
        }
      });
    } else if(obj.event === 'detail'){
      // alert(data.id);
      // alert(data.studentiden);
      //弹出层
      layer.open({
        type: 2, 
        title:'详细信息',
        area: ['84%','86%'],
        offset:['5%','8%'],
        scrollbar: true,
        content: 'repair_no_read_item.html?id='+data.id+'&type=0',//这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
        success: function(layero,index){
        
        }
      }); 

    }
  });
});

layui.use('table', function(){ //渲染公共报修
  var table = layui.table;
  var util = layui.util;
  var indata = {};
  indata.managerId = 1;
  indata.type = 0;
  table.render({
    elem: '#message_table'
    ,url:head+"/repair/noReadList?managerId="+id+"&type=1"
    ,toolbar: '#toolbarDemo'
    ,title: '用户数据表'
    ,request: {
      pageName: 'pageNum' //页码的参数名称，默认：page
      ,limitName: 'pageSize' //每页数据量的参数名，默认：limit
    }
    ,cols: [[ 
      {field:'applicantName', title:'申报人', width:'15%'}
      ,{field:'repairAddr', title:'维修地点', width:'15%'}
      ,{field:'addTime', title:'申报时间', width:'15%', templet:function(d){return util.toDateString(d.ctime*1,"yyyy-MM-dd HH:mm")}}
      ,{field:'questionMsg', title:'问题描述',width:'40%', maxlength:'20'}
      ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:'15%'}
    ]]
    ,page:true
  });
  
  
  //监听行工具事件
  table.on('tool(test2)', function(obj){
    var data = obj.data;
    //console.log(obj)
    if(obj.event === 'refuse'){
      var id = data.id;
      layer.open({
        type: 2, 
        title:'详细信息',
        area: ['84%','86%'],
        offset:['5%','8%'],
        scrollbar: true,
        content: 'refuse_message_other.html?id='+id+'&type=1',//这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
        success: function(layero,index){
        
        }
      });
    } else if(obj.event === 'detail'){
      // alert(data.id);
      // alert(data.studentiden);
      //弹出层
      layer.open({
        type: 2, 
        title:'详细信息',
        area: ['84%','86%'],
        offset:['5%','8%'],
        scrollbar: true,
        content: 'repair_no_read_item_other.html?id='+data.id+'&type=1',//这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
        success: function(layero,index){
        
        }
      }); 

    }
  });
});
